package cn.tedu.zhyl.system.controller;

import cn.tedu.zhyl.base.response.JsonResult;
import cn.tedu.zhyl.base.response.PageResponse;
import cn.tedu.zhyl.base.response.StatusCode;
import cn.tedu.zhyl.nurseManager.pojo.dto.NurseProjectQuery;
import cn.tedu.zhyl.nurseManager.pojo.vo.NurseProjectVO;
import cn.tedu.zhyl.system.pojo.dto.SysPostParams;
import cn.tedu.zhyl.system.pojo.vo.SysDeptVo;
import cn.tedu.zhyl.system.pojo.vo.SysPostVO;
import cn.tedu.zhyl.system.service.SysPostService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/system/post/")
public class SysPostController {
    @Autowired
    private SysPostService sysPostService;
    @GetMapping("select/")
    public JsonResult<List<SysPostVO>> select(SysPostParams postParams){
        log.debug("部门查询参数为:{}",postParams);
        List<SysPostVO> list =sysPostService.getList(postParams);
        log.debug("控制器中查询部门结果为:{}",list);
        return JsonResult.ok(list);
    }

    @PostMapping("save")
    public JsonResult save(@RequestBody SysPostParams params){
        sysPostService.save(params);
        return JsonResult.ok();
    }
    @GetMapping("delete/{id}")
    public JsonResult delete(@PathVariable("id")Long id){
        sysPostService.delete(id);
        return JsonResult.ok();
    }
}
